const Generator = require('yeoman-generator')

module.exports = class extends Generator {
  prompting () {
    return this.prompt([
      {
        type: 'input',
        name: 'name',
        message: 'Your project name',
        default: this.appname // appname 为项目生成目录名称
      }
    ])
    .then(answers => {
      this.answers = answers
    })
  }
  writing () {
    const templates = [
      'public',
      'public/favicon.ico',
      'public/index.html',
      'src',
      'src/api',
      'src/api/index.js',
      'src/api/login.js',
      'src/assets',
      'src/assets/images',
      'src/assets/images/user.png',
      'src/assets/images/user-default.png',
      'src/assets/scss',
      'src/assets/scss/_variable.scss',
      'src/assets/scss/app.scss',
      'src/assets/scss/common.scss',
      'src/assets/scss/home.scss',
      'src/assets/scss/reset.scss',
      'src/components',
      'src/components/EChart.vue',
      'src/components/Icon.vue',
      'src/components/IconSvg.vue',
      'src/components/Tabs.vue',
      'src/icons',
      'src/icons/svg',
      'src/icons/svg/daochu.svg',
      'src/icons/svg/daoru.svg',
      'src/icons/svg/morentouxiang.svg',
      'src/icons/svg/tuichu.svg',
      'src/icons/index.js',
      'src/layout',
      'src/layout/components',
      'src/layout/components/CommonAside.vue',
      'src/layout/components/CommonForm.vue',
      'src/layout/components/CommonHeader.vue',
      'src/layout/components/CommonTab.vue',
      'src/layout/components/CommonTable.vue',
      'src/layout/components/index.js',
      'src/layout/Main.vue',
      'src/mock',
      'src/mock/home.js',
      'src/mock/index.js',
      'src/mock/permission.js',
      'src/mock/user.js',
      'src/router',
      'src/router/index.js',
      'src/router/routes.js',
      'src/store',
      'src/store/modules',
      'src/store/modules/tab.js',
      'src/store/modules/user.js',
      'src/store/getters.js',
      'src/store/index.js',
      'src/utlis',
      'src/utlis/bus.js',
      'src/utlis/config.js',
      'src/utlis/request.js',
      'src/views',
      'src/views/CollectiFDataFiles',
      'src/views/CollectiFDataFiles/index.vue',
      'src/views/Home',
      'src/views/Home/Home.vue',
      'src/views/Login',
      'src/views/Login/Login.vue',
      'src/views/MobileTerminalTargeKnowledgeManagement',
      'src/views/MobileTerminalTargeKnowledgeManagement/index.vue',
      'src/views/PlatformTargetKnowledgeManagement',
      'src/views/PlatformTargetKnowledgeManagement/index.vue',
      'src/views/RegionalSpecificKnowledgeManagement',
      'src/views/RegionalSpecificKnowledgeManagement/index.vue',
      'src/views/RestoreThePostInformationMaterialFile',
      'src/views/RestoreThePostInformationMaterialFile/index.vue',
      'src/views/TheGlobalQuantity',
      'src/views/TheGlobalQuantity/index.vue',
      '.browserslistrc',
      '.eslintrc.js',
      '.gitignore',
      'babel.config.js',
      'package.json',
      'package-lock.json',
      'postcss.config.js',
      'README.md',
      'vue.config.js',
      'yarn.lock'
    ]
    templates.forEach(item => {
      this.fs.copyTpl(
        this.templatePath(item),
        this.destinationPath(item),
        this.answers
      )
    })
  }
}




